package org.yray.io.rocketmqdemo.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class KafkaConsumer {
    // 消费监听
    @KafkaListener(topics = {"messages"})
    public void receiveMessages(ConsumerRecord record){
        // 消费的哪个topic、partition的消息,打印出消息内容
        log.info("简单消费：" + record.getTopic() + "-" + record.getPartition() + "-" + record.getValue());
    }
}